﻿<%@ WebHandler Language="C#" Class="Training.Web.AjaxHandler.Loaddata.validasiNamaRole" %>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using Training.Library.DataAccess.Administration.UserManagement;
using Training.Library.DomainObject.Administration.UserManagement;
using Training.Library.Enum;
using Training.Web.Support;
using Newtonsoft.Json.Linq;
using System.Text;

namespace Training.Web.AjaxHandler.Loaddata
{
    public class validasiNamaRole : Training.Web.BaseHandler
    {
        recRoleRepo roleDal = new recRoleRepo(ConfigurationManager.ConnectionStrings["TrainingConn"].ConnectionString);
        
        public override void ProcessRequest(HttpContext context)
        {
            base.ProcessRequest(context);

            string name = context.Request.Params["name"];
            short isInternal = short.Parse(context.Request.Params["isInternal"].ToString());
            int jml = roleDal.validasiRoleName(name, isInternal);

            StringBuilder sbProject = new StringBuilder();

            sbProject.Append("{");
            sbProject.AppendFormat("  {0}Name{0}:{0}{1}{0}", "\"", jml);
            sbProject.Append("}");

            context.Response.Write(sbProject.ToString());
        }

        public override bool IsReusable
        {
            get
            {
                return false;
            }
        }

    }
}